<template>
    <div class="report">
        <!-- <iframe class="iframes" src="http://61.240.138.156:336/Reports_WINCC/Pages/Report.aspx?ItemPath=%2f%e6%b5%8b%e8%af%95%e6%8a%a5%e8%a1%a8%e9%93%be%e6%8e%a520211124" frameborder="0"></iframe> -->
        <iframe class="iframes" :src="url" frameborder="0"></iframe>
    </div>
</template>

<script>

export default {
    data(){
        return {
            url:"",
            // id:this.$route.params.id
        }
    },
    watch:{
        $route(to, from){
            console.log(11111112222)
            this.url = decodeURIComponent(this.getParams().url)
        },
        url(val){
            console.log(val)
            if(val){
                this.url = decodeURIComponent(this.getParams().url)
                this.$forceUpdate()
            }
        }
    },
    created(){
        this.url = decodeURIComponent(this.getParams().url)
    },
    methods:{
        // 截取url参数
            getParams() {
                var data = {};
                var url = window.location.href
                url.split('?').forEach(el=>{
                    el.split('&').forEach(item => {
                        data[item.split("=")[0]] = item.split("=")[1]
                    })
                })
                return data
            },
    }
}
</script>
<style scoped>
    .iframes{
        width: 100%;
        height: calc(100vh - 60px);
    }
    .report{
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
    }
</style>